#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableUSFBuffDao:DaoBase<TableUSFBuff>
    {
        public override string GetFileName()
        {
            return "TableUSFBuff.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableUSFBuff>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableUSFBuff model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.buffId)) UnityEngine.Debug.LogError("数据表id重复:TableUSFBuff->id: " + model.buffId);
            #endif
            cachePrimaryInt[model.buffId] = model;
        }
        protected override TableUSFBuff ParseRowData(string[] rowData)
        {
            TableUSFBuff data = new TableUSFBuff();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.buffId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.battleBuffers = rowData[1];
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.totalTime = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.duration = int.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.groupId = int.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.priority = int.Parse(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.isClientSide = int.Parse(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.stateEffect = ParseData<int>(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.activateEffect = ParseData<int>(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.icon = rowData[9];
            }
            if (!string.IsNullOrEmpty(rowData[10]))
            {
                data.fortrestParticle = int.Parse(rowData[10]);
            }
            if (!string.IsNullOrEmpty(rowData[11]))
            {
                data.buffDesc = rowData[11];
            }
            if (!string.IsNullOrEmpty(rowData[12]))
            {
                data.isShowFlyText = int.Parse(rowData[12]);
            }
            return data;
        }
    }
}
